﻿/*

/-----------------------------------------------\
|          CODE by Kirati Isarapungpun          |
|       For North - Chiang Mai University       |
|       Software Engineering Project 2013       |
|                                               |
|  |-|>===================================<|-|  |
|                                               |
|       Course planning for Bachelor of         |
| Science degree in software engineering 2012   | 
|      Faculty of Science and Technology,       |
|        North - Chiang Mai University          |
|                                               |
\-----------------------------------------------/

/												\
	mainUser	:	หน้า main เพื่อเรียกใช้ออฟชั่นต่างๆ   
\												/


*/


$(function()
{
	$('#logout').button();
	$('#li_main').button().css({'text-align': 'left','width': '280','height': '40'});
	$('#li_plan').button().css({'text-align': 'left','width': '280','height': '40'});
	//$('#li_view').button().css({'text-align': 'left','width': '280','height': '40'});
	$('#li_structure').button().css({'text-align': 'left','width': '280','height': '40'});
	getUserData();
	if(window.usercheck == 0)
	{
		window.usercheck = 1;
		sPlan_button();
	}
	main_button();
	//checklogin();
});

function getUserData()
{
	$.getJSON('class/_requser.php',function(data)
	{
		$.each(data,function(key,val){
			$('#userHeader').html('Student ID : '+val['userId']+', Student Name : '+val['name']+', Year : '+val['year']);
		});
	});
	
}

function main_button()
{
	$('#tooltip').hide();
	$.get('ui/report.php',function(data)
	{
		$('#workarea').html(data);
	});
}

function sPlan_button()
{
	$('#tooltip').show();
	$.get('ui/manageStudentPlan.php',function(data)
	{
		$('#workarea').html(data);
	});
}
/*
function view_button()
{
$.get('ui/.php',function(data)
	{
		$('#workarea').html(data);
	});
}*/

function structure_button()
{
	$('#tooltip').hide();
	$.get('ui/structure.php',function(data)
	{
		$('#workarea').html(data);
	});
}